namespace Agro.Models
{
    using System;
    using SN.Data;


    /// <summary>
    /// 表名：T_RoleAction 主键列：RoleActonID
    /// </summary>
    [SerializableAttribute()]
    public partial class T_RoleAction : Entity
    {

        protected Int32 _RoleActonID;

        protected Int32 _ActionID;

        protected Int32 _RoleID;

        /// <summary>
        /// ID
        /// </summary>
        public Int32 RoleActonID
        {
            get
            {
                return this._RoleActonID;
            }
            set
            {
                this.OnPropertyValueChange(_.RoleActonID, _RoleActonID, value);
                this._RoleActonID = value;
            }
        }

        /// <summary>
        /// 功能ID
        /// </summary>
        public Int32 ActionID
        {
            get
            {
                return this._ActionID;
            }
            set
            {
                this.OnPropertyValueChange(_.ActionID, _ActionID, value);
                this._ActionID = value;
            }
        }

        /// <summary>
        /// 角色ID
        /// </summary>
        public Int32 RoleID
        {
            get
            {
                return this._RoleID;
            }
            set
            {
                this.OnPropertyValueChange(_.RoleID, _RoleID, value);
                this._RoleID = value;
            }
        }

        /// <summary>
        /// 获取实体对应的表名
        /// </summary>
        protected override Table GetTable()
        {
            return new Table<T_RoleAction>("T_RoleAction");
        }

        /// <summary>
        /// 获取实体中的标识列
        /// </summary>
        protected override Field GetIdentityField()
        {
            return _.RoleActonID;
        }

        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        protected override Field[] GetPrimaryKeyFields()
        {
            return new Field[] {
                        _.RoleActonID};
        }

        /// <summary>
        /// 获取列信息
        /// </summary>
        protected override Field[] GetFields()
        {
            return new Field[] {
                        _.RoleActonID,
                        _.ActionID,
                        _.RoleID};
        }

        /// <summary>
        /// 获取列数据
        /// </summary>
        protected override object[] GetValues()
        {
            return new object[] {
                        this._RoleActonID,
                        this._ActionID,
                        this._RoleID};
        }

        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        protected override void SetValues(IRowReader reader)
        {
            if ((false == reader.IsDBNull(_.RoleActonID)))
            {
                this._RoleActonID = reader.GetInt32(_.RoleActonID);
            }
            if ((false == reader.IsDBNull(_.ActionID)))
            {
                this._ActionID = reader.GetInt32(_.ActionID);
            }
            if ((false == reader.IsDBNull(_.RoleID)))
            {
                this._RoleID = reader.GetInt32(_.RoleID);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if ((obj == null))
            {
                return false;
            }
            if ((false == typeof(T_RoleAction).IsAssignableFrom(obj.GetType())))
            {
                return false;
            }
            if ((((object)(this)) == ((object)(obj))))
            {
                return true;
            }
            return false;
        }

        public class _
        {

            /// <summary>
            /// 表示选择所有列，与*等同
            /// </summary>
            public static AllField All = new AllField<T_RoleAction>();

            /// <summary>
            /// ID - 字段名：RoleActonID - 数据类型：Int32
            /// </summary>
            public static Field RoleActonID = new Field<T_RoleAction>("RoleActonID");

            /// <summary>
            /// 功能ID - 字段名：ActionID - 数据类型：Int32
            /// </summary>
            public static Field ActionID = new Field<T_RoleAction>("ActionID");

            /// <summary>
            /// 角色ID - 字段名：RoleID - 数据类型：Int32
            /// </summary>
            public static Field RoleID = new Field<T_RoleAction>("RoleID");
        }
    }
}
